package message;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class PingServerResponseMessage extends Message
{
	private static final long serialVersionUID = 1L;
	public enum ServerStatus { Initiating, Running }
	private ServerStatus status;
	private long timeIntiated;
	private boolean timeIntiatedSet = false;
	
	public ServerStatus getStatus()
	{
		return status;
	}
	@XmlElement(name = "status", required = true)
	public void setStatus(ServerStatus status)
	{
		if (this.status == null)
			this.status = status;
	}
	public long getTimeIntiated()
	{
		return timeIntiated;
	}
	@XmlElement(name = "timeIntiated", required = true)
	public void setTimeIntiated(long timeIntiated)
	{
		if (!timeIntiatedSet)
		{
			this.timeIntiated = timeIntiated;
			timeIntiatedSet = true;
		}
	}
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		result = prime * result + (int) (timeIntiated ^ (timeIntiated >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PingServerResponseMessage other = (PingServerResponseMessage) obj;
		if (status != other.status)
			return false;
		if (timeIntiated != other.timeIntiated)
			return false;
		return true;
	}
}
